<?php    

include'../Classes/attemployeeHandler.php';
include'../Classes/db.php';

$x=new DbConnect();
$con=$x->getConnection();

$empno=$_GET['empno'];
//$year=$_GET['year'];
//$month=$_GET['month'];
$dt1=$_GET['date'];
$month=substr($dt1,3,2);
$year=substr($dt1,6,4);
$date=substr($dt1,0,2);
$day=$year."-".$month."-".$date;//create a new object

$in=$_GET['in'];
$out=$_GET['out'];
$id=$_GET['id'];
$day=$year."-".$month."-".$date;//arrange date format

$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));//get time now
	 $yearnw=date('Y',$time_now); 
 	$monthnw=date('m',$time_now); 
 	$datenw=date('d',$time_now);


$att=new AttEmployeeHandler();
$att->setConnect($con);
$att->setEmpno($empno);

//future date validation
if (($year < $yearnw) || (($year == $yearnw)&&($month < $monthnw)) || (($year == $yearnw)&&($month = $monthnw)&&($day <= $datenw)))
		{
		$result=$att->attUpdate($id,$day,$in,$out);
		echo $result;
		}
else
		{
		echo "Future Date !";
		}

?>